<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>小车入场</title>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
    <script src="/js/layui-v2.4.3/layui/layui.js"></script>
    <script src="/js/pub_js/time.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="/js/jQuery/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/js/jQuery/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/js/utf8-jsp/ueditor.config.js"></script>
    <script type="text/javascript" src="/js/utf8-jsp/ueditor.all.js"></script>
    <script type="text/javascript" charset="utf-8" src="/js/utf8-jsp/lang/zh-cn/zh-cn.js"></script>
    <link rel="stylesheet" href="/js/layui-v2.4.3/layui/css/layui.css" media="all">
</head>
<body>
<form class="layui-form" action="">
    <div class="layui-form-item" style="width:40%">
        <label class="layui-form-label">车牌号</label>
        <div class="layui-input-block">
            <input type="text" name="car" id="car" required lay-verify="required" autocomplete="off" class="layui-input"
                   unselectable="on" style="width: 200px;">
        </div>
    </div>

    <div class="layui-form-item" style="width:40%">
        <label class="layui-form-label">入口</label>
        <div class="layui-input-block">
            <select id="id" name="id">
                <option value="0">一号入口</option>
                <option value="12">二号入口</option>
            </select>
        </div>
    </div>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">确定</button>

        </div>
    </div>
</form>


<script>
    //Dem


    layui.use('form', function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        $.ajaxSetup({
            headers: {
                "Authorization": window.localStorage.getItem("token")
            }
        });

        var form = layui.form;
        form.on('submit(formDemo)', function (data) {
            var id = document.getElementById("id").value;
            var car = document.getElementById("car").value;
            $.ajax({
                type: "get",
                url: "/path/small/in",
                dataType: "json",
                contentType: "application/json",
                data:{"id":id,"car":car},
                success: function (result) {
                    if (result.msg == 'success') {
                        layer.alert(result.data, function () {
                            parent.location.reload();
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                            parent.location.reload();
                        });
                    }
                    else {
                        layer.alert(result.msg);
                    }
                }
            });
            return false;
        });
    });


</script>

</body>
</html>